from flask_restful import Resource, reqparse
from app.api.services.service_effect import ServiceEffect
from . import checkoutArgs


class ApiEffectList(Resource):
    def __init__(self):
        self.reqparse = reqparse.RequestParser()
        self.reqparse.add_argument(
            'packageName', type=str, required=True, help="packageName error")
        self.reqparse.add_argument(
            'folderName', type=str, required=True, help="folderName error")
        super(ApiEffectList, self).__init__()

    def get(self):
        args = self.reqparse.parse_args(strict=True)
        args_filter = checkoutArgs(args)
        return ServiceEffect().list_effect(**args_filter)
